#include "widget2.h"
#include "ui_widget2.h"
#include<QPushButton>
#include<QDebug>
Widget2::Widget2(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget2)
{
    ui->setupUi(this);
    QPushButton *btn=new QPushButton;
    //让窗口出现在目标窗口中
    btn->setParent(this);
    btn->setText("dogson");
    btn->show();//以顶层方式弹出窗口
    QPushButton *btn2=new QPushButton("wolfson2",this);
    btn2->show();
    resize(600,600);//改变窗口大小
    btn2->move(200,100);//相对坐标
    setWindowTitle("first window");//改窗口标题
    setFixedSize(800,800);//固定大小
    btn->resize(50,50);
    //对象树，父类释放导致子类释放，所以不用手动
    connect(btn,&QPushButton::clicked,this,&Widget2::close);
}
Widget2::~Widget2()
{
    delete ui;
    //qDebug()<<"widge 析构     ";
}

